package com.qf.dao.impl;

import com.qf.dao.StudentDao;
import com.qf.domain.Student;
import com.qf.utils.JDBCUtils2;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

public class StudentDaoImpl implements StudentDao {
    private JdbcTemplate jd=new JdbcTemplate(JDBCUtils2.getDs());
    @Override
    public Student zhu(String username, String password) {
        try {
            String sql="select * from ya where username=? and password=?";
            Student student = jd.queryForObject(sql, new BeanPropertyRowMapper<Student>(Student.class), username, password);
            return student;
        } catch (DataAccessException e) {
          return null;
        }
    }

}
